import { BrowserWindow } from 'electron'
import { registProviderWindow, unRegistProviderWindow } from 'electron-wpc'
import { TAG_WIN_PROVIDER } from 'app/config'
import { WindowCenter } from 'app/window'

export class WpcChannel {
    static init() {
        const winProvider = new BrowserWindow({
            show: false,
            parent: WindowCenter.getWindow('main'),
        })
        registProviderWindow(winProvider, TAG_WIN_PROVIDER)
        winProvider.on('close', () => {
            unRegistProviderWindow(TAG_WIN_PROVIDER)
        })
    }
}
